﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DB_NH.DB_Map.ywxt.TenderOffer
{
    using NHibernate;
    using NHibernate.Mapping.ByCode;
    using NHibernate.Mapping.ByCode.Conformist;

    using DB_NH.DB_Model.ywxt.TenderOffer;

    public class Map_TenderOffer : EntityMapping<TenderOffer>
    {
        public Map_TenderOffer()
        {
            ManyToOne(x => x.Bidder, map =>
            {
                map.Column("BidderId");
            });

            Bag(x => x.Details, map =>
            {
                map.Key(keyMapper => keyMapper.Column("OfferId"));
                map.Cascade(Cascade.None);
            }, rel => rel.OneToMany());

            Property(x => x.LinkerEmail, map =>
            {
                map.Length(200);
            });

            Property(x => x.LinkerName, map =>
            {
                map.Length(20);
            });

            Property(x => x.LinkerPhone, map =>
            {
                map.Length(20);
            });

            Property(x => x.OfferDate);
            
            Property(x => x.OfferRemark, map =>
            {
                map.Length(80000000);
            });

            Property(x => x.OfferValue);

            ManyToOne(x => x.OpUser, map =>
            {
                map.Column("OpUserId");
            });

            Property(x => x.OtherRemark, map =>
            {
                map.Length(80000000);
            });

            Property(x => x.OtherValue);

            Property(x => x.PayDate);
            Property(x => x.PayFlag);
            Property(x => x.PayFpCode, map =>
            {
                map.Length(100);
            });

            Property(x => x.PayRemark, map =>
            {
                map.Length(80000000);
            });

            ManyToOne(x => x.PayUser, map =>
            {
                map.Column("PayUserId");
            });

            Property(x => x.PayValue);

            Property(x => x.TypeFlag);

            Property(x => x.TenderOfferTitle, map =>
            {
                map.Length(400);
            });

        }
    }
}
